package Eclass.BatchClass;

import java.util.ArrayList;
import java.util.List;

import ibatis.IbatisHelper;

import com.ibatis.sqlmap.client.SqlMapClient;

public class BatchClassManager {
	private SqlMapClient ibatis;

	public BatchClassManager() {
		this.ibatis = IbatisHelper.getSqlMapInstance();
	}
	
	/*public  List getListBatchClass(){
		List result = null;
		
		try{
			result = ibatis.queryForList("eClass.getListBatchClass", "");
		}
		catch(Exception ex){
			ex.printStackTrace();
		}
		return result;
	}
	
	private  List getListExamBatchClass(){
		List inpt = getListBatchClass();
		List list = new ArrayList();
		int jml = inpt.size();
		for(int i=0;i<jml;i++){
			BatchClassModel bcm = (BatchClassModel)inpt.get(i);
			String s = (bcm.getClassName()).toUpperCase();
			if(s.contains("MID-TERM") || s.contains("COMPRE")){
				list.add(bcm);
			}
		}
		return list; 
	}*/
	
	public  List getListUniqueExamBatchClass(){
		List result = null;
		
		try{
			result = ibatis.queryForList("eClass.getListUniqueBatchClassExam", "");
		}
		catch(Exception ex){
			ex.printStackTrace();
		}
		return result;
	}
	
	public  List getListUniqueExamBatchClassWithAddition(Integer batchClassId){
		List result = null;
		
		try{
			result = ibatis.queryForList("eClass.getListUniqueBatchClassExamWithAddition", batchClassId);
		}
		catch(Exception ex){
			ex.printStackTrace();
		}
		return result;
	}
	
	public BatchClassModel getBatchClassById(Integer batchClassId){
		BatchClassModel result = null;
		
		try{
			result = (BatchClassModel) ibatis.queryForObject("eClass.getBatchClassById", batchClassId);
		}
		catch(Exception ex){
			ex.printStackTrace();
		}
		return result;
	}
}
